/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.jeesite.modules.ajz.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.JoinTable;
import com.jeesite.common.mybatis.annotation.JoinTable.Type;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.mapper.query.QueryType;
import com.jeesite.common.utils.excel.annotation.ExcelField;
import com.jeesite.common.utils.excel.annotation.ExcelFields;
import com.jeesite.common.utils.excel.fieldtype.OfficeType;
import com.jeesite.modules.sys.entity.Office;
import org.hibernate.validator.constraints.Length;

import java.util.Date;

/**
 * 店面信息表Entity
 * @author esan
 * @version 2019-06-24
 */
@Table(name = "ajz_store_info", alias = "a", columns = {
        @Column(name = "id", attrName = "id", label = "id", isPK = true),
        @Column(name = "legal_person", attrName = "legalPerson", label = "法人"),
        @Column(name = "legal_person_tel", attrName = "legalPersonTel", label = "法人电话"),
        @Column(name = "contact_person", attrName = "contactPerson", label = "联系人"),
        @Column(name = "contact_person_tel", attrName = "contactPersonTel", label = "联系人电话"),
        @Column(name = "enterprise_num", attrName = "enterpriseNum", label = "营业执照号码"),
        @Column(name = "enterprise_picture", attrName = "enterprisePicture", label = "营业执照照片"),
        @Column(name = "enterprise_name", attrName = "enterpriseName", label = "营业执照名", queryType = QueryType.LIKE),
        @Column(name = "store_type", attrName = "storeType", label = "企业性质"),
        @Column(name = "signboard_pic", attrName = "signboardPic", label = "户外招牌图片存放路径"),
        @Column(name = "registered", attrName = "registered", label = "注册地"),
        @Column(name = "addr", attrName = "addr", label = "地址"),
        @Column(name = "area", attrName = "area", label = "面积"),
        @Column(name = "floor_count", attrName = "floorCount", label = "楼层高度"),
        @Column(name = "emp_count", attrName = "empCount", label = "员工数量"),
        @Column(name = "danger_lev", attrName = "dangerLev", label = "隐患等级"),
        @Column(name = "buiness_content", attrName = "buinessContent", label = "经营范围"),
        @Column(name = "longitude", attrName = "longitude", label = "经度"),
        @Column(name = "dimension", attrName = "dimension", label = "维度"),
        @Column(name = "office_code", attrName = "office.officeCode", label = "部门id"),
        @Column(name = "openid", attrName = "openid", label = "联系人微信"),
        @Column(name = "check_status", attrName = "checkStatus", label = "检查状态 1.待复查 2.需整改 3.无隐患"),
        @Column(name = "cycle_index", attrName = "cycleIndex", label = "完成第几轮排查"),
        @Column(name = "cycle_ajz_index", attrName = "cycleAjzIndex", label = "计划第几轮排查"),
        @Column(name = "deadline", attrName = "deadline", label = "整改截止时间"),
        @Column(name = "is_triad", attrName = "isTriad", label = "是否三合一"),
        @Column(name = "is_trouble", attrName = "isTrouble", label = "是否包含隐患点"),
        @Column(includeEntity = DataEntity.class),
        @Column(name = "signboard", attrName = "signboard", label = "户外招牌名称"),
}, joinTable = {
        @JoinTable(type = Type.LEFT_JOIN, entity = Office.class, attrName = "office", alias = "u22",
                on = "u22.office_code = a.office_code", columns = {
                @Column(name = "office_code", label = "机构编码", isPK = true),
                @Column(name = "office_name", label = "机构名称", isQuery = false),
                @Column(name = "parent_code", label = "父级机构名称", isQuery = false),
        }), @JoinTable(type = Type.LEFT_JOIN, entity = AjzRecord.class, alias = "record", attrName = "ajzRecord",
        on = "a.id = record.base_id AND record.base_type= 'store' and record.table_type=#{ajzRecord.tableType}", columns = {
        @Column(name = "id", attrName = "id", label = "id", isPK = true),
        @Column(includeEntity = DataEntity.class),
        @Column(name = "base_type", attrName = "baseType", label = "安监类型"),
        @Column(name = "deadline", attrName = "deadline", label = "截止时间", queryType = QueryType.GTE),
        @Column(name = "opinion", attrName = "opinion", label = "整改意见"),
        @Column(name = "base_id", attrName = "ajzStoreInfo.id", label = "基础表id"),
        @Column(name = "cycle_index", attrName = "cycleIndex", label = "排查轮数"),
        @Column(name = "cycle_count", attrName = "cycleCount", label = "排查次数"),
        @Column(name = "cycle_ajz_index", attrName = "cycleAjzIndex", label = "安监总轮数"),
        @Column(name = "check_status", attrName = "checkStatus", label = "检查状态"),
        @Column(name = "table_type", attrName = "tableType", label = "安监类型"),
        @Column(name = "message_push", attrName = "messagePush", label = "是否推送消息"),
}), @JoinTable(type = Type.LEFT_JOIN, entity = AjzNaturalGas.class, attrName = "ajzNaturalGas", alias = "ajzNaturalGas",
        on = "ajzNaturalGas.base_id = a.id and ajzNaturalGas.status = 0", columns = {
        @Column(name = "id", attrName = "id", label = "id", isPK = true),
        @Column(name = "natural_gas_nature", attrName = "naturalGasNature", label = "天然气性质"),
        @Column(name = "natural_gas_contract", attrName = "naturalGasContract", label = "天然气合同"),
}), @JoinTable(type = Type.LEFT_JOIN, entity = AjzFoodSafety.class, attrName = "ajzFoodSafety", alias = "ajzFoodSafety",
        on = "ajzFoodSafety.base_id = a.id and ajzFoodSafety.status = 0", columns = {
        @Column(name = "id", attrName = "id", label = "id", isPK = true),
        @Column(name = "id", attrName = "id", label = "液化气表id", isPK = true),
        @Column(name = "health_certificate", attrName = "healthCertificate", label = "健康证"),
}), @JoinTable(type = Type.LEFT_JOIN, entity = AjzLiquefiedGas.class, attrName = "ajzLiquefiedGas", alias = "ajzLiquefiedGas",
        on = "ajzLiquefiedGas.base_id = a.id and ajzLiquefiedGas.status = 0", columns = {
        @Column(name = "id", attrName = "id", label = "id", isPK = true),
        @Column(name = "liquefied_gas_nature", attrName = "liquefiedGasNature", label = "液化气性质"),
        @Column(name = "liquefied_gas_contract", attrName = "liquefiedGasContract", label = "液化气合同"),
}),
}, orderBy = "a.update_date DESC"
)
public class AjzStoreInfo extends DataEntity<AjzStoreInfo> {
    private static final long serialVersionUID = 1L;
    private String legalPerson;        // 法人
    private String legalPersonTel;        // 法人电话
    private String contactPerson;        // 联系人
    private String contactPersonTel;        // 联系人电话
    private String enterpriseNum;        // 营业执照号码
    private String enterprisePicture;        // 营业执照照片
    private String enterpriseName;        // 营业执照名
    private String storeType;        // 企业性质
    private String signboardPic;        // 户外招牌图片存放路径
    private String registered;        // 注册地
    private String addr;        // 地址
    private String area;        // 面积
    private String floorCount;        // 楼层高度
    private String empCount;        // 员工数量
    private String dangerLev;        // 隐患等级
    private String buinessContent;        // 经营范围
    private String longitude;        // 经度
    private String dimension;        // 维度
	private Office office;        // 部门
    private String openid;        // 联系人微信
    private String checkStatus;        // 检查状态 1.待复查 2.需整改 3.无隐患
    private String cycleIndex;        // 完成第几轮排查
    private String cycleAjzIndex;        // 计划第几轮排查
    private Date deadline;        // 整改截止时间
    private String isTriad;        // 是否三合一
    private String isTrouble;        // 是否包含隐患点
    private String signboard;        // 户外招牌名称

    private AjzRecord ajzRecord;
    private AjzFoodSafety ajzFoodSafety;
    private AjzNaturalGas ajzNaturalGas;
    private AjzLiquefiedGas ajzLiquefiedGas;


    /*为专题列表上的四个专题提供的属性*/
	private int all;
	private int uninspect;
	private int uncheck;
	private int checked;

	public int getAll() {
		return all;
	}

	public void setAll(int all) {
		this.all = all;
	}

	public int getUninspect() {
		return uninspect;
	}

	public void setUninspect(int uninspect) {
		this.uninspect = uninspect;
	}

	public int getUncheck() {
		return uncheck;
	}

	public void setUncheck(int uncheck) {
		this.uncheck = uncheck;
	}

	public int getChecked() {
		return checked;
	}

	public void setChecked(int checked) {
		this.checked = checked;
	}

	public AjzRecord getAjzRecord() { return ajzRecord; }
    public void setAjzRecord(AjzRecord ajzRecord) { this.ajzRecord = ajzRecord; }

    public AjzFoodSafety getAjzFoodSafety() { return ajzFoodSafety; }
    public void setAjzFoodSafety(AjzFoodSafety ajzFoodSafety) { this.ajzFoodSafety = ajzFoodSafety; }

    public AjzNaturalGas getAjzNaturalGas() { return ajzNaturalGas; }
    public void setAjzNaturalGas(AjzNaturalGas ajzNaturalGas) { this.ajzNaturalGas = ajzNaturalGas; }

    public AjzLiquefiedGas getAjzLiquefiedGas() { return ajzLiquefiedGas; }
    public void setAjzLiquefiedGas(AjzLiquefiedGas ajzLiquefiedGas) { this.ajzLiquefiedGas = ajzLiquefiedGas; }

    public AjzStoreInfo() {
        this(null);
    }

	public AjzStoreInfo(String id){
		super(id);
	}

	@ExcelFields({
			@ExcelField(title = "法人", attrName = "legalPerson", align = ExcelField.Align.CENTER, sort = 10),
			@ExcelField(title = "法人电话", attrName = "legalPersonTel", align = ExcelField.Align.CENTER, sort = 20),
			@ExcelField(title = "联系人", attrName = "contactPerson", align = ExcelField.Align.CENTER, sort = 30),
			@ExcelField(title = "联系人电话", attrName = "contactPersonTel", align = ExcelField.Align.CENTER, sort = 40),
			@ExcelField(title = "营业执照号码", attrName = "enterpriseNum", align = ExcelField.Align.CENTER, sort = 50),
			@ExcelField(title = "营业执照名", attrName = "enterpriseName", align = ExcelField.Align.CENTER, sort = 60),
			@ExcelField(title = "企业性质", attrName = "storeType", align = ExcelField.Align.CENTER, sort = 70, fieldType = OfficeType.class),
			@ExcelField(title = "注册地", attrName = "registered", align = ExcelField.Align.LEFT, sort = 80),
			@ExcelField(title = "地址", attrName = "addr", align = ExcelField.Align.CENTER, sort = 90),
			@ExcelField(title = "面积", attrName = "area", align = ExcelField.Align.CENTER, sort = 100),
			@ExcelField(title = "楼层高度", attrName = "floorCount", align = ExcelField.Align.CENTER, sort = 110),
			@ExcelField(title = "员工数量", attrName = "empCount", align = ExcelField.Align.CENTER, sort = 120),
			@ExcelField(title = "经营范围", attrName = "buinessContent", align = ExcelField.Align.CENTER, sort = 130),
	})
	
	@Length(min=0, max=100, message="法人长度不能超过 100 个字符")
	public String getLegalPerson() {
		return legalPerson;
	}

	public void setLegalPerson(String legalPerson) {
		this.legalPerson = legalPerson;
	}
	
	@Length(min=0, max=20, message="法人电话长度不能超过 20 个字符")
	public String getLegalPersonTel() {
		return legalPersonTel;
	}

	public void setLegalPersonTel(String legalPersonTel) {
		this.legalPersonTel = legalPersonTel;
	}
	
	@Length(min=0, max=64, message="联系人长度不能超过 64 个字符")
	public String getContactPerson() {
		return contactPerson;
	}

	public void setContactPerson(String contactPerson) {
		this.contactPerson = contactPerson;
	}
	
	@Length(min=0, max=255, message="联系人电话长度不能超过 255 个字符")
	public String getContactPersonTel() {
		return contactPersonTel;
	}

	public void setContactPersonTel(String contactPersonTel) {
		this.contactPersonTel = contactPersonTel;
	}
	
	@Length(min=0, max=255, message="营业执照号码长度不能超过 255 个字符")
	public String getEnterpriseNum() {
		return enterpriseNum;
	}

	public void setEnterpriseNum(String enterpriseNum) {
		this.enterpriseNum = enterpriseNum;
	}
	
	@Length(min=0, max=255, message="营业执照照片长度不能超过 255 个字符")
	public String getEnterprisePicture() {
		return enterprisePicture;
	}

	public void setEnterprisePicture(String enterprisePicture) {
		this.enterprisePicture = enterprisePicture;
	}
	
	@Length(min=0, max=255, message="营业执照名长度不能超过 255 个字符")
	public String getEnterpriseName() {
		return enterpriseName;
	}

	public void setEnterpriseName(String enterpriseName) {
		this.enterpriseName = enterpriseName;
	}
	
	@Length(min=0, max=255, message="企业性质长度不能超过 255 个字符")
	public String getStoreType() {
		return storeType;
	}

	public void setStoreType(String storeType) {
		this.storeType = storeType;
	}
	
	@Length(min=0, max=255, message="户外招牌图片存放路径长度不能超过 255 个字符")
	public String getSignboardPic() {
		return signboardPic;
	}

	public void setSignboardPic(String signboardPic) {
		this.signboardPic = signboardPic;
	}
	
	@Length(min=0, max=255, message="注册地长度不能超过 255 个字符")
	public String getRegistered() {
		return registered;
	}

	public void setRegistered(String registered) {
		this.registered = registered;
	}
	
	@Length(min=0, max=64, message="地址长度不能超过 64 个字符")
	public String getAddr() {
		return addr;
	}

	public void setAddr(String addr) {
		this.addr = addr;
	}
	
	@Length(min=0, max=64, message="面积长度不能超过 64 个字符")
	public String getArea() {
		return area;
	}

	public void setArea(String area) {
		this.area = area;
	}
	
	@Length(min=0, max=255, message="楼层高度长度不能超过 255 个字符")
	public String getFloorCount() {
		return floorCount;
	}

	public void setFloorCount(String floorCount) {
		this.floorCount = floorCount;
	}
	
	@Length(min=0, max=255, message="员工数量长度不能超过 255 个字符")
	public String getEmpCount() {
		return empCount;
	}

	public void setEmpCount(String empCount) {
		this.empCount = empCount;
	}
	
	@Length(min=0, max=255, message="隐患等级长度不能超过 255 个字符")
	public String getDangerLev() {
		return dangerLev;
	}

	public void setDangerLev(String dangerLev) {
		this.dangerLev = dangerLev;
	}
	
	@Length(min=0, max=255, message="经营范围长度不能超过 255 个字符")
	public String getBuinessContent() {
		return buinessContent;
	}

	public void setBuinessContent(String buinessContent) {
		this.buinessContent = buinessContent;
	}
	
	@Length(min=0, max=64, message="经度长度不能超过 64 个字符")
	public String getLongitude() {
		return longitude;
	}

	public void setLongitude(String longitude) {
		this.longitude = longitude;
	}
	
	@Length(min=0, max=64, message="维度长度不能超过 64 个字符")
	public String getDimension() {
		return dimension;
	}

	public void setDimension(String dimension) {
		this.dimension = dimension;
	}

	public Office getOffice() {
		return office;
	}

	public void setOffice(Office office) {
		this.office = office;
	}

	
	@Length(min=0, max=255, message="联系人微信长度不能超过 255 个字符")
	public String getOpenid() {
		return openid;
	}

	public void setOpenid(String openid) {
		this.openid = openid;
	}

	@Length(min=0, max=10, message="无隐患长度不能超过 10 个字符")
	public String getCheckStatus() {
		return checkStatus;
	}

	public void setCheckStatus(String checkStatus) {
		this.checkStatus = checkStatus;
	}
	
	@Length(min=0, max=10, message="完成第几轮排查长度不能超过 10 个字符")
	public String getCycleIndex() {
		return cycleIndex;
	}

	public void setCycleIndex(String cycleIndex) {
		this.cycleIndex = cycleIndex;
	}
	
	@Length(min=0, max=255, message="计划第几轮排查长度不能超过 255 个字符")
	public String getCycleAjzIndex() {
		return cycleAjzIndex;
	}

	public void setCycleAjzIndex(String cycleAjzIndex) {
		this.cycleAjzIndex = cycleAjzIndex;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
	public Date getDeadline() {
		return deadline;
	}

	public void setDeadline(Date deadline) {
		this.deadline = deadline;
	}
	
	@Length(min=0, max=255, message="是否三合一长度不能超过 255 个字符")
	public String getIsTriad() {
		return isTriad;
	}

	public void setIsTriad(String isTriad) {
		this.isTriad = isTriad;
	}
	
	@Length(min=0, max=1, message="是否包含隐患点长度不能超过 1 个字符")
	public String getIsTrouble() {
		return isTrouble;
	}

	public void setIsTrouble(String isTrouble) {
		this.isTrouble = isTrouble;
	}
	
	@Length(min=0, max=255, message="户外招牌名称长度不能超过 255 个字符")
	public String getSignboard() {
		return signboard;
	}

	public void setSignboard(String signboard) {
		this.signboard = signboard;
	}
	
}